﻿@page "/_School/School/Details/{id}"
@using WBBvNext.ViewModel._School.SchoolVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@Model" >
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.FormRow">

            <Display @bind-Value="@Model.Entity.SchoolCode"   ShowLabel="true"/>
            <Display @bind-Value="@Model.Entity.SchoolName"   ShowLabel="true"/>
            <Display @bind-Value="@Model.Entity.SchoolType"   ShowLabel="true"/>
                @if (Model.Entity.PdfFileId.HasValue){
                    <div>
                          <label class="control-label is-display">PdfFile</label>
                          <div><Button Size="Size.Small" Text="@WtmBlazor.Localizer["Sys.Download"]" OnClick="@(async x => await Download($"/api/_file/DownloadFile/{Model.Entity.PdfFileId}",null, HttpMethodEnum.GET))" /></div>
                    </div>
                }

            <Display @bind-Value="@Model.Entity.Remark"   ShowLabel="true"/>
    </Row>
    <div class="modal-footer table-modal-footer">
        <Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose" />
    </div>
</ValidateForm>

@code {

    private SchoolVM Model = null;
    private ValidateForm vform { get; set; }
    [Parameter]
    public string id { get; set; }


    protected override async Task OnInitializedAsync()
    {

        var rv = await WtmBlazor.Api.CallAPI<SchoolVM>($"/api/School/{id}");
        Model = rv.Data;
    }

    public void OnClose()
    {
        CloseDialog();
    }

}
